package com.offcn.test;

/* 创建线程
* 1. 定义类实现Runnable接口
* 2. 重写run方法
* 3. 创建实现类对象
* 4. 创建线程对象，并将实现类对象作为参数传递给线程对象的构造方法
* 5. 调用start方法，启动线程
* */

public class SingleTon implements Runnable{

    public static void main(String[] args) {
        SingleTon singleTon1 = new SingleTon();
        SingleTon singleTon2 = new SingleTon();
        SingleTon singleTon3 = new SingleTon();
        Thread thread1 = new Thread(singleTon1);
        Thread thread2 = new Thread(singleTon2);
        Thread thread3 = new Thread(singleTon3);
        thread1.start();
        thread2.start();
        thread3.start();
    }

    @Override
    public void run() {
        Student.getInstance(2001,"小白");
        People.getInstance(1001,"lisi");
    }
}
